package com.sinosoft.system.util.page;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: Pagenation 
 * @Description: TODO(分页工具类) 
 * @date 2016年1月22日 上午10:24:42 
 * @author shangxp
 */
public class Pagenation implements Serializable{
    private static final long serialVersionUID = 1L;

    private int pageSize=10; // 页面大小:一个页面显示多少个数据 默认是10条
    private int pageNumber;
    private int total;
    private List<?> rows;
    private List<String> queryKeys;
    private List<Object> queryValues;
    
    private int startRow;

    public int getStartRow() {
    	if(this.pageNumber<1){
			this.pageNumber=1;
		}
		return (pageNumber-1)*pageSize;
	}

	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNumber() {
		if(this.pageNumber<1){
			this.pageNumber=1;
		}
		return pageNumber;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}


	public List<?> getRows() {
		return rows;
	}

	public void setRows(List<?> rows) {
		this.rows = rows;
	}

	public List<String> getQueryKeys() {
		return queryKeys;
	}

	public void setQueryKeys(List<String> queryKeys) {
		this.queryKeys = queryKeys;
	}

	public List<Object> getQueryValues() {
		return queryValues;
	}

	public void setQueryValues(List<Object> queryValues) {
		this.queryValues = queryValues;
	}

	public Pagenation() {
    }

	/**
     * 
     * @param pageSize 页大小
     * @param pageNumber  当前页码
     * @param total 总数据量
     */
    
    public Pagenation(int pageSize, int pageNumber, int total) {
    	this.pageNumber = pageNumber;
    	this.pageSize = pageSize;
    	this.total = total;
    }

	public Pagenation(int pageSize, int pageNumber) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.startRow = ((pageNumber<1?1:pageNumber)-1)*pageSize;
	}

	public Pagenation(int pageSize, int pageNumber, int total, List<?> rows, List<String> queryKeys, List<Object> queryValues) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.total = total;
		this.queryKeys = queryKeys;
		this.queryValues = queryValues;
		this.rows = rows;
	}
	
	public Pagenation(int pageSize, int pageNumber,  List<String> queryKeys, List<Object> queryValues) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.queryKeys = queryKeys;
		this.queryValues = queryValues;
	}

	public Pagenation(int pageSize, int pageNumber, int total, List<String> queryKeys, List<Object> queryValues) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.total = total;
		this.queryKeys = queryKeys;
		this.queryValues = queryValues;
	}

	public Pagenation(int pageSize, int pageNumber, int total, List<?> rows) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.total = total;
		this.rows = rows;
	}
    
	
    
    
}
